/**
Json Demo
ee
**/

package main

import (
	"encoding/json"

	"fmt"

	//"strings"
)

type Book struct {
	Title string

	Authors []string

	Publisher string

	IsPublished bool

	Price float64
}

/**
func main() {

gobook := Book{"Go语言编程", []string{"XuShiwei", "BertYuan"}, "ituring.com", true, 9.99}

//json 转换

jsonData, err := json.Marshal(gobook)

if err != nil {

fmt.Println(err)

return

}

	fmt.Println(string(jsonData))
}
**/
//var str string = `
//{"Title":"Go语言编程","Authors":["XuShiwei","BertYuan"],"Publisher":"ituring.com","IsPublished":true,"Price":9.99}

//`

func main() {
	//把json 格式的数据转换成结构体
	bSlice := []byte(str)
	var book Book
	err := json.Unmarshal(bSlice, &book)
	if err != nil {
		fmt.Println(err)
		return
	}
	fmt.Println(book.Authors[1])
}
